<?php
namespace app\api\controller\mall;

use app\api\controller\ApiBase;
use app\common\business\Goods as goodsBusi;
use app\common\lib\Show;
// 分类API
class Lists extends ApiBase
{
	public function index(){
		$pageSize = input('param.page_size',0,'intval');
		$categoryId = input('param.category_id',0,'intval');
		if(!$categoryId){
			return Show::success();
		}
		$data = [
			'category_path_id' => $categoryId,
		];

		$field = input('param.field','listorder','trim');
		$order = input('param.order',2,'intval');
		$order = $order == 2 ? 'desc' : 'asc';
		$order = [$field => $order];
		$goods = (new goodsBusi())->getNormalLists($data,$pageSize,$order);

		return Show::success($goods);
	}
}